package com.ruoyi.tranShort.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tranShort.domain.ShortClassGrade;
import com.ruoyi.tranShort.mapper.ShortClassGradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tranShort.mapper.ShortPersonMapper;
import com.ruoyi.tranShort.domain.ShortPerson;
import com.ruoyi.tranShort.service.IShortPersonService;

/**
 * 人员Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-08-09
 */
@Service
public class ShortPersonServiceImpl implements IShortPersonService 
{
    @Autowired
    private ShortPersonMapper shortPersonMapper;
    @Autowired
    private ShortClassGradeMapper shortClassGradeMapper;

    /**
     * 查询人员
     * 
     * @param id 人员主键
     * @return 人员
     */
    @Override
    public ShortPerson selectShortPersonById(Long id)
    {
        return shortPersonMapper.selectShortPersonById(id);
    }

    /**
     * 查询人员列表
     * 
     * @param shortPerson 人员
     * @return 人员
     */
    @Override
    public List<ShortPerson> selectShortPersonList(ShortPerson shortPerson)
    {
        return shortPersonMapper.selectShortPersonList(shortPerson);
    }

    /**
     * 新增人员
     * 
     * @param shortPerson 人员
     * @return 结果
     */
    @Override
    public int insertShortPerson(ShortPerson shortPerson)
    {
        shortPerson.setCreateTime(DateUtils.getNowDate());
        return shortPersonMapper.insertShortPerson(shortPerson);
    }

    /**
     * 修改人员
     * 
     * @param shortPerson 人员
     * @return 结果
     */
    @Override
    public int updateShortPerson(ShortPerson shortPerson)
    {
        return shortPersonMapper.updateShortPerson(shortPerson);
    }

    /**
     * 批量删除人员
     * 
     * @param ids 需要删除的人员主键
     * @return 结果
     */
    @Override
    public int deleteShortPersonByIds(Long[] ids)
    {
        return shortPersonMapper.deleteShortPersonByIds(ids);
    }

    /**
     * 删除人员信息
     * 
     * @param id 人员主键
     * @return 结果
     */
    @Override
    public int deleteShortPersonById(Long id)
    {
        return shortPersonMapper.deleteShortPersonById(id);
    }

    /**
     * 根据班级获取人员
     * @return
     */
    @Override
    public List<ShortClassGrade> getPersonGroupClassGrade() {
        return shortClassGradeMapper.SelectShortClassGradeAndPerson();
    }
}
